#ifndef frm_control_TDate_H
#define frm_control_TDate_H

#include "svl_TVariant.h"
#include "frm_control_TString.h"
#include "frm_control_TLine.h"

namespace frm { namespace control {

///////////////////////////////////////////////////////////////////////////////

struct TDate : public TLine
{
  TDate(TWindow &Window);
  //
  void SetNull();
  bool IsNull () { return isNull;}
  //
  void SetValue(svl::TVariant V);
  virtual bool UpdateValue(svl::TDateTime V);
  void makeupdate();
  //svl::TVariant GetVariant()       { svl::TVariant Vreturn SetValue(V.DateTime()); }
  //
  svl::TDateTime GetValue();
  void SetValue(svl::TDateTime V);
  void ReupdateValue();
  //
  TDate &SetStyle(TString::TStyle &V);

protected:  
  virtual void TComponent_FocusEnter()  { TLine::TComponent_FocusEnter(); }
  virtual void TComponent_FocusExit();
  virtual bool TComponent_FocusEnable() { return true;}

private:  
  struct TPart : public TString
  {
    TPart(TDate *Date,int Len);
    //
    void SetNull();
    void SetValue(int V);
    int  GetValue();
    //
    virtual bool UpdateValue(svl::TString V);
    virtual bool Focus_SetByPos(int Pos);
    virtual void TComponent_KeyboardKey(grf::TKeyboardKey &KeyboardKey);
    virtual void TComponent_KeyboardChar(grf::TKeyboardChar &KeyboardChar);
    virtual void TComponent_FocusExit();
    //
    TDate *date;
    int    len;
  };
  struct TSeparator : public TString
  {
    TSeparator(TDate *Date) : TString(Date->GetWindow()) { Date->AddChildLast(this,true); SetValue("."); }
    //
    virtual bool TComponent_FocusEnable() { return false;}
  };
  //
  void ShowCheckDate();
  //
  TPart *day,*month,*year;
  TSeparator *sep1,*sep2;
  bool isNull;
};

///////////////////////////////////////////////////////////////////////////////
}}

#endif
